#ifndef _DISPLAYPLOT_H_
#define _DISPLAYPLOT_H_

#include <qwt/qwt_plot.h>
#include <QtSql>
/*==================================================================
 *    作者：Creater
 *    简介：查询数据库并生成历史数据波形
 *    主页： unix8.net
 *    日期：2014-04-23
/*==================================================================*/
class QwtPlotGrid;
class QwtSymbol;
class QwtPlotCurve;
class QwtDateScaleDraw;
class QwtDateScaleEngine;
class DisplayPlot: public QwtPlot
{
    Q_OBJECT

public:
    //需要绘制的5种线性
    enum CurveType
    {
        //RainCurve,
        //ShallowCurve,
        //DeepCruve,
       // AngleCurve,
       // StressCurve,
		GCurve,
		YCurve,
		VCurve,
        EXAMPLE,
        NCurves = 4
    };
    /*!
     * \brief DisplayPlot 根据表与类型画曲线
     * \param table  需要绘制的表
     * \param type
     */
    DisplayPlot(QString table,QString &d, CurveType type, QWidget * = NULL );
    ~DisplayPlot();
    bool Collect(QString s, QString &f, CurveType type);

public Q_SLOTS:
    //导出成PDF
    void exportPlot();

    //legend选中与反选时的切换
    void legendChecked( const QVariant &, bool on);
private Q_SLOTS:
    //显示线
    void showItem( QwtPlotItem *, bool on );
    //变换grid样式
    void gridChange(int i );
private:
    QwtPlotGrid *d_grid;
    //SQL
    QSqlTableModel model;
    //Curve
    QwtPlotCurve* curveArr[NCurves];
    QString title[4];
    int index;
};

#endif
